import React from 'react'
import {Route,Redirect} from 'react-router-dom'

const RouteWithSubRoutes = (route) => (
    <Route path={route.path} render={props => (
        // pass the sub-routes down to keep nesting
        1 !== 1?(
        <route.component {...props} routes={route.routes}/>
        ):(<Redirect to={{
            pathname: '/login',
            state: { from: props.location }
        }}/>)
    )}/>
)


export default RouteWithSubRoutes